package com.mobi.Survey.map;

import android.graphics.Bitmap;

import com.google.android.gms.maps.model.LatLng;
import com.mobi.Survey.lib.model.FavoritePojo;

public class MapMarker {

	private Bitmap iconBitmap;
	private String iconUrl;
	private String latitude;
	private String longitude;
	private long surveyId;
 
	private String userId;
	private String description;
	private boolean isCalculatedLatLng;
	private int totalPoints;
	private LatLng calculatedLatLng;

	private boolean favorite;

	public boolean isCalculatedLatLng() {
		return isCalculatedLatLng;
	}

	public void setCalculatedLatLng(boolean isCalculatedLatLng) {
		this.isCalculatedLatLng = isCalculatedLatLng;
	}

	public LatLng getCalculatedLatLng() {
		return calculatedLatLng;
	}

	public void setCalculatedLatLng(LatLng calculatedLatLng) {
		this.calculatedLatLng = calculatedLatLng;
	}

	public String getDescription() {
		return description;
	}

	public void setDescription(String description) {
		this.description = description;
	}

	public String getLatitude() {
		return latitude;
	}

	public void setLatitude(String latitude) {
		this.latitude = latitude;
	}

	public String getLongitude() {
		return longitude;
	}

	public void setLongitude(String longitude) {
		this.longitude = longitude;
	}

	public String getAddress() {
		return address;
	}

	public String getUserId() {
		return userId;
	}

	public void setUserId(String userId) {
		this.userId = userId;
	}

	public void setAddress(String address) {
		this.address = address;
	}

	private String address;

	public long getSurveyId() {
		return surveyId;
	}

	public void setSurveyId(long surveyId) {
		this.surveyId = surveyId;
	}

	public String getIconUrl() {
		return iconUrl;
	}

	public int getTotalPoints() {
		return totalPoints;
	}

	public void setTotalPoints(int totalPoints) {
		this.totalPoints = totalPoints;
	}

	public void setIconUrl(String iconUrl) {
		this.iconUrl = iconUrl;
	}

 

	public Bitmap getIconBitmap() {
		return iconBitmap;
	}

	public void setIconBitmap(Bitmap iconBitmap) {
		this.iconBitmap = iconBitmap;
	}

	public boolean isFavorite() {
		return favorite;
	}

	public void setFavorite(boolean favorite) {
		this.favorite = favorite;
	}

	@Override
	public boolean equals(Object o) {

		if (o == this) {
			return true;
		}
		if (!(o instanceof MapMarker)) {
			return true;
		}
		MapMarker marker = (MapMarker) o;

		if (address == null) {
			address = "";
		}
		if (latitude == null) {
			latitude = "";
		}
		if (longitude == null) {
			longitude = "";
		}
		//
		if (marker.address == null) {
			marker.address = "";
		}
		if (marker.latitude == null) {
			marker.latitude = "";
		}
		if (marker.longitude == null) {
			marker.longitude = "";
		}
		if (this.latitude.equals(marker.latitude)
				&& this.longitude.equals(marker.longitude)
				&& this.address.equals(marker.address)) {
			return true;
		}

		return false;

	}

	public FavoritePojo toFavoritePojo() {
		FavoritePojo pojo = new FavoritePojo();
		pojo.setDescription(this.description);
		pojo.setUserId(this.userId);
		pojo.setIconUrl(this.iconUrl);
		pojo.setSurveyId(this.surveyId);
		pojo.setFavorite(this.isFavorite());
		//pojo.setIconBitmap(this.getIconBitmap());
		return pojo;
	}

	@Override
	public int hashCode() {
		if (address == null) {
			address = "";
		}
		if (latitude == null) {
			latitude = "";
		}
		if (longitude == null) {
			longitude = "";
		}

		return longitude.hashCode() + latitude.hashCode() + address.hashCode();
	}

}
